package com.rongji.dfish.hello.pub.view;

import com.rongji.dfish.ui.helper.FlexGrid;
import com.rongji.dfish.ui.helper.FormPanel;
import com.rongji.dfish.ui.helper.GridPanel;
import com.rongji.dfish.ui.layout.ButtonBar;
import com.rongji.dfish.ui.layout.HorizontalLayout;
import com.rongji.dfish.ui.layout.VerticalLayout;
import com.rongji.dfish.ui.layout.View;
import com.rongji.dfish.ui.widget.Html;
import com.rongji.dfish.ui.widget.PageBar;

/**
 * Description: 本项目中的公用视图类 Copyright: Copyright © 2018 Company: rongji
 * 
 * @author YuLM
 * @version 1.0
 *
 *          Modification History: Date Author Version Description
 *          ------------------------------------------------------------------
 *          2018-3-25 下午9:02:29 YuLM 1.0 1.0 Version
 */
public class CommonView {

	public static String W_MAIN = "main";
	public static String W_MAIN_TOP = "m_top";
	public static String W_MAIN_TITLE = "m_title";
	public static String W_MAIN_OPER = "m_oper";
	public static String W_MAIN_SEARCH = "m_search";
	public static String W_MAIN_CONTENT = "m_content";
	public static String W_MAIN_PAGE = "m_page";

	public static String DLG_ROOT = "d_root";
	public static String DLG_MAIN = "d_main";
	public static String DLG_OPER = "d_oper";

	public View buildMainView() {
		View view = new View();

		VerticalLayout root = new VerticalLayout(W_MAIN);
		view.add(root);

		HorizontalLayout mainTop = new HorizontalLayout(W_MAIN_TOP).setHeight(50);
		root.add(mainTop);

		Html mainTitle = new Html(null).setId(W_MAIN_TITLE);
		mainTop.add(mainTitle);

		ButtonBar mainOper = new ButtonBar(W_MAIN_OPER).setWidth(200).setSpace(10);
		mainTop.add(mainOper);

		FlexGrid mainSearch = new FlexGrid(W_MAIN_SEARCH).setHeight(-1);
		root.add(mainSearch);

		GridPanel mainContent = new GridPanel(W_MAIN_CONTENT);
		root.add(mainContent);

		PageBar mainPage = new PageBar(W_MAIN_PAGE, PageBar.TYPE_TEXT).setHeight(60).setAlign(PageBar.ALIGN_RIGHT);
		root.add(mainPage);
		mainPage.setBtncount(5);

		return view;
	}

	public View buildDialogView() {
		View view = new View();

		VerticalLayout root = new VerticalLayout(DLG_ROOT);
		view.add(root);

		FormPanel main = new FormPanel(DLG_MAIN);
		root.add(main);

		ButtonBar oper = new ButtonBar(DLG_OPER).setHeight(60).setStyle("padding-right:20px").setWmin(20).setSpace(10)
				.setCls("dlg-oper").setAlign(ButtonBar.ALIGN_RIGHT);
		root.add(oper);

		return view;
	}

}
